package com.chj.comp.service.demo1.controller;

import com.chj.comp.service.demo1.service.IRabbitmqTestService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author cuihui
 * @since 2022-04-16
 */
@RestController
@RequestMapping("/rabbitmq")
@Api(tags = "rabbitmq测试接口")
@Slf4j
public class RabbitmqTestController {

    @Autowired
    IRabbitmqTestService rabbitmqTestService;

    /**
     * 生产消息(简单队列)
     */
    @GetMapping("/sendSimpleMsg")
    @ApiOperation(value = "生产消息(简单队列)")
    public void sendSimpleMsg() {
        rabbitmqTestService.sendSimpleMsg();
    }

    /**
     * 生产消息(工作队列)
     */
    @GetMapping("/sendWorkMsg")
    @ApiOperation(value = "生产消息(工作队列)")
    public void sendWorkMsg() {
        rabbitmqTestService.sendWorkMsg();
    }

    /**
     * 生产消息(发布订阅模型-广播类型)
     */
    @GetMapping("/sendFanoutMsg")
    @ApiOperation(value = "生产消息(发布订阅模型-广播类型)")
    public void sendFanoutMsg() {
        rabbitmqTestService.sendFanoutMsg();
    }

    /**
     * 生产消息(发布订阅模型-路由类型)
     */
    @GetMapping("/sendDirectMsg")
    @ApiOperation(value = "生产消息(发布订阅模型-路由类型)")
    public void sendDirectMsg() {
        rabbitmqTestService.sendDirectMsg();
    }

    /**
     * 生产消息(发布订阅模型-主题类型)
     */
    @GetMapping("/sendTopicMsg")
    @ApiOperation(value = "生产消息(发布订阅模型-主题类型)")
    public void sendTopicMsg() {
        rabbitmqTestService.sendTopicMsg();
    }
}
